import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const router =  new Router({
  base:'/',
  mode:'history',
  routes: [
    //微信公众号路由
    {
      path: '/',
      name: 'findJobs',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/findJobs')),'findJobs'),
      meta: {
        title:"人多多",
        content: '人多多'
      }
    },
    {
      path: '/jobPage/:jobId',
      name: 'jobPage',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/jobPage')),'jobPage'),
      meta: {
        title:"人多多",
        content: '人多多'
      }
    },
    {
      path: '/binding/:type/:jobId',
      name: 'binding',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/binding')),'binding'),
      meta: {
        title:"绑定手机号",
        content: '绑定手机号'
      }
    },
    {
      path: '/bindingSuccess',
      name: 'bindingSuccess',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/bindingSuccess')),'bindingSuccess'),
      meta: {
        title:"绑定手机号成功",
        content: '绑定手机号成功'
      }
    },
    {
      path: '/done',
      name: 'done',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/done')),'done'),
      meta: {
        title:"报名成功",
        content: '报名成功'
      }
    },
    {
      path: '/search',
      name: 'search',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/search')),'search'),
      meta: {
        title:"搜索工作",
        content: '搜索工作'
      }
    },
    {
      path: '/center',
      name: 'center',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/center')),'center'),
      meta: {
        title:"会员中心",
        content: '会员中心'
      }
    },
    {
      path: '/personalData',
      name: 'personalData',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/personalData')),'personalData'),
      meta: {
        title:"完善个人资料",
        content: '完善个人资料'
      }
    },
    {
      path: '/returnFee',
      name: 'returnFee',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/returnFee')),'returnFee'),
      meta: {
        title:"我的返费",
        content: '我的返费'
      }
    },
    {
      path: '/signedJobs',
      name: 'signedJobs',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/signedJobs')),'signedJobs'),
      meta: {
        title:"我的报名",
        content: '我的报名'
      }
    },
    {
      path: '/referralFee',
      name: 'referralFee',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/referralFee')),'referralFee'),
      meta: {
        title:"我的推荐费",
        content: '我的推荐费'
      }
    },
    {
      path: '/wages',
      name: 'wages',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/wages')),'wages'),
      meta: {
        title:"我的工资",
        content: '我的工资'
      }
    },
    {
      path: '/salaryDetails',
      name: 'salaryDetails',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/salaryDetails')),'salaryDetails'),
      meta: {
        title:"工资明细",
        content: '工资明细'
      }
    },
    {
      path: '/referral',
      name: 'referral',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/referral')),'referral'),
      meta: {
        title:"推荐好友宣传",
        content: '推荐好友宣传'
      }
    },
    {
      path: '/referralSuccess',
      name: 'referralSuccess',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/referralSuccess')),'referralSuccess'),
      meta: {
        title:"推荐成功",
        content: '推荐成功'
      }
    },
    {
      path: '/navigation',
      name: 'navigation',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/navigation')),'navigation'),
      meta: {
        title:"门店导航",
        content: '门店导航'
      }
    },
    {
      path: '/address',
      name: 'address',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/address')),'address'),
      meta: {
        title:"户籍所在地",
        content: '户籍所在地'
      }
    },
    {
      path: '/successfulRegistration',
      name: 'successfulRegistration',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/successfulRegistration')),'successfulRegistration'),
      meta: {
        title:"报名成功",
        content: '报名成功'
      }
    },
    {
      path: '/serviceQR',
      name: 'serviceQR',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/serviceQR')),'serviceQR'),
      meta: {
        title:"在线客服",
        content: '在线客服'
      }
    },
    {
      path: '/storeList',
      name: 'storeList',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/storeList')),'storeList'),
      meta: {
        title:"门店列表",
        content: '门店列表'
      }
    },
    {
      path: '/myAgent',
      name: 'myAgent',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/myAgent')),'myAgent'),
      meta: {
        title:"我的经纪人",
        content: '我的经纪人'
      }
    },
    {
      path: '/cooperation',
      name: 'cooperation',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/cooperation')),'cooperation'),
      meta: {
        title:"合作加盟",
        content: '合作加盟'
      }
    },
    {
      path: '/scan',
      name: 'scan',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/scanQr')),'scanQr'),
      meta: {
        title:"扫码关注公众号",
        content: '扫码关注公众号'
      }
    },{
      path: '/myLogistics',
      name: 'myLogistics',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/myLogistics')),'myLogistics'),
      meta: {
        title:"后勤服务",
        content: '后勤服务'
      }
    },{
      path: '/commitOrder',
      name: 'commitOrder',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/commitOrder')),'commitOrder'),
      meta: {
        title:"提交订单",
        content: '提交订单'
      }
    },{
      path: '/extend',
      name: 'extend',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/extend')),'extend'),
      meta: {
        title:"邀请新人",
        content: '邀请新人'
      }
    }, {
      path: '/successOrder',
      name: 'successOrder',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/successOrder')),'successOrder'),
      meta: {
        title:"提交订单",
        content: '提交订单'
      }
    }, {
      path: '/extendDetail',
      name: 'extendDetail',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/extendDetail')),'extendDetail'),
      meta: {
        title:"邀新奖励",
        content: '邀新奖励'
      }
    }, {
      path: '/myCooperation',
      name: 'myCooperation',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/myCooperation')),'myCooperation'),
      meta: {
        title:"我的加盟",
        content: '我的加盟'
      }
    }, {
      path: '/wagesDetail',
      name: 'wagesDetail',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/wagesDetail')),'wagesDetail'),
      meta: {
        title:"工资明细",
        content: '工资明细'
      }
    },
    {
      path: '/together',
      name: 'together',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/together')),'together'),
      meta: {
        title:"业务合作",
        content: '业务合作'
      }
    },
    {
      path: '/shopQR',
      name: 'shopQr',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/shopQr')),'shopQr'),
      meta: {
        title:"店铺二维码",
        content: '店铺二维码'
      }
    },
    {
      path: '/successfulCopSign',
      name: '提交合作加盟成功',
      component:r=>require.ensure([],()=>r(require('@/components/wechat/successfulCopSign')),'successfulCopSign'),
      meta: {
        title:"合作加盟报名成功",
        content: '合作加盟报名成功'
      }
    }
  ]
})
router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

export default router
